import { IlineInfo } from '../type/lineInfoType';
// import { distanceCalculate } from './distanceCalculate';
interface IstationMap {
  stationId: number;
  labelNo: number;
  lng: number;
  lat: number;
}

const busMap = function (lineDetail0: IlineInfo, lineDetail1: IlineInfo) {
  let stationDetail = lineDetail0.data.stationDetails.map(function (station) {
    const newStation: IstationMap = {
      stationId: station.stationId,
      labelNo: station.labelNo,
      lng: station.lng,
      lat: station.lat,
    };
    return newStation;
  });
  if (lineDetail1.retcode === '001') {
    stationDetail = stationDetail.concat(
      lineDetail1.data.stationDetails.map(function (station) {
        const newStation: IstationMap = {
          stationId: station.stationId,
          labelNo: -station.labelNo,
          lng: station.lng,
          lat: station.lat,
        };
        return newStation;
      }),
    );
  }
  return stationDetail;
};

export default { busMap };
